<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        s = 1563847412
        var reverse = function(x) {
            x = x.toString().split('').reverse()
            if(x[x.length-1]=='-'){
                x.unshift(x.pop())

            }
            x = parseInt(x.join(''))
            return (Math.pow(-2,31)<x && x<Math.pow(2,31)-1) ? x:0
        };

        var reverse = function(x) {
            x = x.toString().split('').reverse()
            if(x[x.length-1]=='-'){
                x.unshift(x.pop())

            }
            x = parseInt(x.join(''))
            return (Math.pow(-2,31)<x && x<Math.pow(2,31)-1) ? x:0
        };
        s.split('').reverse().join('')

        console.log(reverse(s));

    </script>
</body>
</html>